<template>
    <h1>{{ "parent" }}</h1>
    <p>Count: {{ count }}</p>
    <button @click="handleClick">+1</button>
    <child />
</template>

<script setup lang="ts">
import { ref, provide } from "vue";
import child from "./child.vue";

let count = ref(2);

const handleClick = () => {
    count.value++;
};

provide("count", count); // 提供 count 变量给子组件和孙子组件
</script>

<style scoped></style>
